package com.dfbz.demo;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_字符串常量池 {
    public static void main(String[] args) {

        // 存储在常量池
        String s1 = "abc";

        // new的东西都存储在堆内存
        String s2 = new String("abc");

        // new的东西都存储在堆内存
        String s3 = new String("abc");


        String s4 ="abc";

        // false
        System.out.println(s1 == s2);
        System.out.println(s1 == s3);

        // false
        System.out.println(s2 == s3);

        // true
        System.out.println(s1 == s4);



    }
}
